package view;

import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.JPanel;

/**
 * Classe representant un panel contenant le background principal
 * @author Lefevre, Thoue
 */
public class PanelPrincipal extends JPanel {
    /**
     * Constructeur
     */
    public PanelPrincipal() {
    }
    /**
     * Methode de dessin du panel servant a afficher l'image
     * @param g 
     */
    @Override
    public void paintComponent(Graphics g) {
        try {
            //Image backgroundImage = ImageIO.read(new File(getClass().getResource("background.jpg").getFile()));
             Image backgroundImage = ImageIO.read(this.getClass().getClassLoader().getResourceAsStream("view/background.jpg"));
            g.drawImage(backgroundImage, 0, 0, null);
        } catch (IOException ex) {
            Logger.getLogger(PanelPrincipal.class.getName()).log(Level.INFO,"Image de fond non trouve.");
        }
    }
}